package sieci.powtorka.dwa;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {

	ServerSocket srvsc;
	
	public Server() throws IOException{
		srvsc= new ServerSocket(4662);
		System.out.println("Server up");
		talk();
	}

	private void talk() throws IOException {
		while(true){
			Socket sc = srvsc.accept();
			BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(sc.getOutputStream()));
			bw.write("Ala ma kota.\n");
			bw.flush();
			bw.write("Ala i As\n");
			bw.close();
		}
	}
	
	
}
